package com.sky.config;

import com.sky.properties.HWeiObsProperties;
import com.sky.utils.HWeiUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * $
 *配置类用户创建HWobsUtil对象
 * @return $
 */
@Configuration
@Slf4j
public class ObsConfiguration {
    @Bean
    @ConditionalOnMissingBean
    public HWeiUtil hweiUtil(HWeiObsProperties hweiObsProperties) {
        log.info("开始创建华为云文件上传工具类对象{}", hweiObsProperties);
      return   new HWeiUtil(hweiObsProperties.getAk(),
              hweiObsProperties.getSk(),hweiObsProperties.getEndPoint(),
              hweiObsProperties.getBucketName());
    }
}
